package com.maserb.monitor.enums;

import java.util.HashMap;
import java.util.Map;

public enum JwQuestionItemTypeEnum {
    DanXuan(1,"单选"),DuoXuan(2,"多选"),WenDa(3,"问答题");

    private int value;
    private String name;

    JwQuestionItemTypeEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    private static Map<Integer,String> map;

    static
    {
        map = new HashMap<>();
        JwQuestionItemTypeEnum[] orgs = JwQuestionItemTypeEnum.values();
        for(JwQuestionItemTypeEnum org : orgs)
        {
            map.put(org.getValue(),org.getName());
        }
    }

    public static String getNameByValue(Integer val)
    {
        if(map.containsKey(val)){
            return map.get(val);
        }else{
            return map.get("未知");
        }

    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    public boolean equals(JwQuestionItemTypeEnum item) {
        return this.getValue() == item.getValue() && this.getName().equals(item.getValue());
    }
}
